package com.example.fouroperations;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class AnswerActivity extends AppCompatActivity {

    public static final String TAG ="AnswerActivity";
    int countdown;//还没有想好如何实现——倒计时
    int quesNum;
    int count;
    ArrayList<String> ques_ans;
    TextView question;
    TextView answer;
    TextView quesID;
    TextView countdownText;

    //倒计时结束显示
//    Toast.makeText(AnswerActivity.this, "msg", Toast.LENGTH_SHORT).show();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_answer);

        //从主页面获取数据
        Intent answerIntent = getIntent();
        Bundle answerBdl = answerIntent.getExtras();
        ques_ans = answerBdl.getStringArrayList("ques_ans");
        quesNum = answerBdl.getInt("ques_num",0);
        countdown = answerBdl.getInt("countdown",0);
        Log.i(TAG, "onCreate: countdown="+countdown);
        Log.i(TAG, "onCreate: ques_num="+ quesNum);
        Log.i(TAG, "onCreate: ques_ans = "+ques_ans);

        countdownText = findViewById(R.id.countdownTitle);//还没有想好如何实现——倒计时
        quesID = findViewById(R.id.quesId);
        question = findViewById(R.id.question);
        answer = findViewById(R.id.answer);

        //
        question.setText(ques_ans.get(0));

        //设置题号
        count = 1;

    }

    //点击"submit"
    public void submitClick(View btn) {
        Log.i(TAG, "submitClick: ");

        //获取用户输入答案
        EditText inputAnswer = findViewById(R.id.inputAnswer);
        String answer_temp = inputAnswer.getText().toString();
        int answer = Integer.valueOf(answer_temp);

        //匹配答案


    }

    //点击"next"
    public void nextClick(View btn) {
        Log.i(TAG, "nextClick: ");


    }

    //点击"finish"
    public void finishClick(View btn) {
        Log.i(TAG, "finishClick: ");


    }
}